<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of template
 *
 * @author nelfrits
 */
class MyTemplate {
    //put your code here
    var $CI;
    function  __construct() {
        $this->CI =& get_instance();
    }
    function gettopmenu(){
        return $this->CI->system_model->get_menu(1);
    }

    function getsecuremenuleft($userid, $menuposition){
		return $this->CI->system_model->get_securemenu($userid, $menuposition,'','');
    }
    
    function getsecuresubmenu($userid, $menuposition){
		$submenu = $this->CI->system_model->get_securemenu($userid, $menuposition,ucfirst($this->CI->router->fetch_class()),$this->CI->router->fetch_method());
		foreach($submenu as $sub)
		{
			echo "<a href='".base_url()."".$sub['URL']."'>&nbsp;<img alt='icon' src='".base_url()."images/icon-next.png' align='absmiddle' />".$sub['MenuName']."</a>&nbsp;&nbsp;";
		}
		
			
    }
    

    function dressing($mainview,$parammain){
        $data['menu'] = $this->gettopmenu();
        $this->CI->load->view('templates/header',$data);
        $this->CI->load->view('templates/rightcolumn',NULL);
        $this->CI->load->view($mainview,$parammain);
        $this->CI->load->view('templates/footer',NULL);
    }

    function dressing_secure($mainview,$parammain){
		$userinfo = $this->CI->session->userdata('UserInfo');
		
		$data['menu'] = $this->gettopmenu();
        $data['leftmenu'] = $this->getsecuremenuleft($userinfo['UserId'], 2);
        $this->CI->load->view('templates/header',$data);
        $this->CI->load->view('templates/secure/leftcolumn',$data);
        $this->CI->load->view($mainview,$parammain);
        $this->CI->load->view('templates/footer',NULL);
    }
    
    function dressing_secure_popup($head, $mainview,$parammain){
		$userinfo = $this->CI->session->userdata('UserInfo');
		$data['title'] = $head;		
		$this->CI->load->view('templates/secure/popup/header',$data);
        $this->CI->load->view($mainview,$parammain);
        $this->CI->load->view('templates/secure/popup/footer',NULL);
    }
    
}
/* End of file template.php */
/* Location: ./application/libraries/template.php */
